package test.test;

import org.junit.Test;
/**
 * https://leetcode.cn/contest/weekly-contest-397/problems/permutation-difference-between-two-strings/
 * todo: 如果不是这么简单怎么做
 *
 */
public class A {
    public int findPermutationDifference(String s, String t) {
        int[] index=new int[128];
        int ans=0;
		for (int i = 0; i <s.length(); i++) {
			index[s.charAt(i)]=i;
		}
		for (int i = 0; i < t.length(); i++) {
			ans+=Math.abs(i-index[t.charAt(i)]);
		}
		return ans;
    }
    
}
